package com.huike.web.controller.system;

import com.huike.clues.domain.SysDictData;
import com.huike.clues.domain.dto.SysDictDto;
import com.huike.clues.domain.vo.SysDictDataVo;
import com.huike.clues.service.DictService;
import com.huike.common.core.controller.BaseController;
import com.huike.common.core.domain.AjaxResult;

import com.huike.common.core.page.TableDataInfo;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@ApiOperation("字典数据")
@RestController
@RequestMapping("/system/dict/type")
public class SysDictDataController extends BaseController {
    @Autowired
    private DictService dictService;
    @PostMapping
    @ApiOperation("新增字典类型")
    public AjaxResult addDictType(SysDictData data){
        dictService.addDictType(data);
        return AjaxResult.success();
    }
    /**
     * 分页查询数据字典类型信息
     *
     * */
    @GetMapping("/list")
    @ApiOperation("分页查询数据字典类型信息")
    public TableDataInfo<List<SysDictData>> list(SysDictDto dto){
        startPage();
        List<SysDictDataVo> list = dictService.selectAll(dto);
        return getDataTable( list);
    }
}
